// File: MathFunctionsDummyDriver.cpp
// Name: Samuel Brush
// Date: 3/26/2014
// Course: CS 325 - Software Development
// Desc: Unit test driver for functions declared in MathFunctions.h
// Usage: Include MathFunctions.h and MathFunctions.cpp when compiling. Run it.

#include "MathFunctions.h"
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;

/* TEST CASE DETAILS FOUND IN TestCases_forMathFunctions.txt. Corresponding IDs are used below on left.

1. test all positive number inputs for each function values: 5.2825,8.746,3.93,62.865,2.678,9.36,1.317,7.684,34.437
2. test all negative number inputs for each function values: -(5.2825,8.746,3.93,62.865,2.678,9.36,1.317,7.684,34.437)
3. test random number inputs for each function
4. test with an empty vector
5. test with a vector with one item
6. test with a vector with a large amount of items (thousands to millions)

*/

int main() {
	//6 vectors, corresponding to each test cases
	vector<double> testInputs[6];

	//seed random number generator
	srand(time(NULL));

	//init vector for test case 1
	testInputs[0].push_back(5.2825);
	testInputs[0].push_back(8.746);
	testInputs[0].push_back(3.93);
	testInputs[0].push_back(62.865);
	testInputs[0].push_back(2.678);
	testInputs[0].push_back(9.36);
	testInputs[0].push_back(1.317);
	testInputs[0].push_back(7.684);
	testInputs[0].push_back(34.437);

	//init vector for test case 2
	testInputs[1].push_back(-5.2825);
	testInputs[1].push_back(-8.746);
	testInputs[1].push_back(-3.93);
	testInputs[1].push_back(-62.865);
	testInputs[1].push_back(-2.678);
	testInputs[1].push_back(-9.36);
	testInputs[1].push_back(-1.317);
	testInputs[1].push_back(-7.684);
	testInputs[1].push_back(-34.437);

	//init vector for test case 3
	for (int i = 0; i < 150; ++i) {
		testInputs[2].push_back(rand());
	}

	//no init for test case 4, as it tests with an empty vector

	//init vector for test case 5
	testInputs[4].push_back(456.279);

	//init vector for test case 6
	for (int i = 0; i < 100000; ++i) {
		testInputs[5].push_back(rand());
	}

	//run each function with each test case as input
	for (int i = 0; i < 6; ++i) {
		double
			meanResult,
			stdevResult,
			kurtosisResult;

		meanResult = mean(testInputs[i]);
		stdevResult = stdev(testInputs[i]);
		kurtosisResult = kurtosis(testInputs[i]);
		
	//output results of the test case
		if (meanResult != DIVIDE_BY_ZERO && kurtosisResult != DIVIDE_BY_ZERO) {
			cout << "TEST CASE " << i + 1 << "\nMean: " << meanResult << "\nStandard deviation: " << stdevResult << "\nKurtosis: " << kurtosisResult << endl << endl;
		}
		else if (meanResult != DIVIDE_BY_ZERO && kurtosisResult == DIVIDE_BY_ZERO) {
			cout << "TEST CASE " << i + 1 << "\nMean: " << meanResult << "\nStandard deviation: " << stdevResult << "\nKurtosis: " << "(no value for 1 input value)" << endl << endl;
		}
		else {
			cout << "TEST CASE " << i + 1 << "\nMean: " << "(no values entered)" << "\nStandard deviation: " << "(no values entered)" << "\nKurtosis: " << "(no values entered)" << endl << endl;
		}
	}


	cin.get();
	return 0;
}